<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>注册事件方式1</button>
    <button>注册事件方式2</button>
    <script>
        var btns = document.getElementsByTagName('button')
        // 注册事件会被覆盖
        btns[0].onclick = function(){
            alert(111)
        }
        btns[0].onclick = function(){
            alert(222)
        }
        // 这种不会覆盖 两个事件触发的方法都会执行
        btns[1].addEventListener ('click',function(){
            alert(111)
        })
        btns[1].addEventListener('click',function(){
            alert(222)
        })


        var obj1={
            "name":"lin"
        }
        console.log(obj1.name);
    </script>
</body>
</html>